.class final Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;
.super Ljava/lang/Object;
.source "ModeSelectDialog.java"

# interfaces
.implements Landroid/widget/AdapterView$OnItemClickListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog;->show(Landroid/content/Context;I)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation


# instance fields
.field final synthetic val$ctx:Landroid/content/Context;

.field final synthetic val$fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

.field final synthetic val$tool:I


# direct methods
.method constructor <init>(Landroid/content/Context;Llt/noframe/gpsfarmguide/analytics/FireAnalytics;I)V
    .locals 0

    .line 58
    iput-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$ctx:Landroid/content/Context;

    iput-object p2, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    iput p3, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$tool:I

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView<",
            "*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .line 62
    invoke-virtual {p1, p3}, Landroid/widget/AdapterView;->getItemAtPosition(I)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Llt/noframe/gpsfarmguide/models/ModeItemModel;

    .line 64
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/models/ModeItemModel;->getGui_type()I

    move-result p2

    const/4 p4, 0x0

    const/4 p5, 0x1

    const/4 v0, 0x2

    if-ne p2, v0, :cond_0

    .line 65
    iget-object p2, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$ctx:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_FINE_LOCATION"

    invoke-static {p2, v1}, Landroidx/core/content/ContextCompat;->checkSelfPermission(Landroid/content/Context;Ljava/lang/String;)I

    move-result p2

    if-eqz p2, :cond_0

    .line 66
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p1

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/Data;->getPermissionsCallbacker()Llt/noframe/gpsfarmguide/PermissionsCallbacker;

    move-result-object p1

    new-array p2, v0, [Ljava/lang/String;

    const-string p3, "android.permission.ACCESS_COARSE_LOCATION"

    aput-object p3, p2, p4

    aput-object v1, p2, p5

    const/16 p3, 0x2e5

    invoke-virtual {p1, p2, p3}, Llt/noframe/gpsfarmguide/PermissionsCallbacker;->onRequestPermission([Ljava/lang/String;I)V

    return-void

    .line 74
    :cond_0
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/models/ModeItemModel;->getGui_type()I

    move-result p2

    if-eq p2, p5, :cond_2

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/models/ModeItemModel;->getGui_type()I

    move-result p2

    if-ne p2, v0, :cond_1

    goto :goto_0

    .line 84
    :cond_1
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/models/ModeItemModel;->getGui_type()I

    move-result p1

    const/4 p2, 0x5

    if-ne p1, p2, :cond_4

    .line 89
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/analytics/FireAnalytics;->sendImportShp()V

    .line 94
    new-instance p1, Lcom/nbsp/materialfilepicker/MaterialFilePicker;

    invoke-direct {p1}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;-><init>()V

    iget-object p2, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$ctx:Landroid/content/Context;

    check-cast p2, Llt/noframe/gpsfarmguide/views/ActivityDrawer;

    invoke-virtual {p1, p2}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;->withActivity(Landroid/app/Activity;)Lcom/nbsp/materialfilepicker/MaterialFilePicker;

    const-string p2, ""

    .line 95
    invoke-virtual {p1, p2}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;->setSaveButtonText(Ljava/lang/String;)Lcom/nbsp/materialfilepicker/MaterialFilePicker;

    const/16 p2, 0x16

    .line 96
    invoke-virtual {p1, p2}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;->withRequestCode(I)Lcom/nbsp/materialfilepicker/MaterialFilePicker;

    const-string p2, "(?i).*\\.(kml|kmz|geojson|Geopackage|shp|shx|dbf|zip)$"

    .line 97
    invoke-static {p2}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;

    move-result-object p2

    invoke-virtual {p1, p2}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;->withFilter(Ljava/util/regex/Pattern;)Lcom/nbsp/materialfilepicker/MaterialFilePicker;

    .line 98
    invoke-virtual {p1, p4}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;->setChooseFolder(Z)Lcom/nbsp/materialfilepicker/MaterialFilePicker;

    .line 99
    invoke-virtual {p1}, Lcom/nbsp/materialfilepicker/MaterialFilePicker;->start()V

    goto :goto_1

    .line 75
    :cond_2
    :goto_0
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p2

    invoke-virtual {p2}, Llt/noframe/gpsfarmguide/Data;->getMap()Lcom/google/android/gms/maps/GoogleMap;

    move-result-object p2

    if-nez p2, :cond_3

    .line 76
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$ctx:Landroid/content/Context;

    const p2, 0x7f110137

    invoke-virtual {p1, p2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object p2

    invoke-static {p1, p2, p5}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object p1

    invoke-virtual {p1}, Landroid/widget/Toast;->show()V

    .line 77
    new-instance p1, Ljava/lang/IllegalStateException;

    const-string p2, "map not loaded but tries to do measuring"

    invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    invoke-static {p1}, Lcom/crashlytics/android/Crashlytics;->logException(Ljava/lang/Throwable;)V

    goto :goto_1

    .line 79
    :cond_3
    iget-object p2, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    iget p4, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$tool:I

    invoke-virtual {p2, p4}, Llt/noframe/gpsfarmguide/analytics/FireAnalytics;->sendMapFieldDraw(I)V

    .line 80
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object p2

    iget p4, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$tool:I

    invoke-virtual {p2, p4}, Llt/noframe/gpsfarmguide/Data;->setTool(I)V

    .line 81
    iget p2, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$tool:I

    invoke-virtual {p1, p2}, Llt/noframe/gpsfarmguide/models/ModeItemModel;->showGui(I)V

    .line 82
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$ctx:Landroid/content/Context;

    iget p2, p0, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog$1;->val$tool:I

    invoke-static {p1, p2, p3}, Llt/noframe/gpsfarmguide/Analytics;->sendUsedMeasurement(Landroid/content/Context;II)V

    .line 103
    :cond_4
    :goto_1
    invoke-static {}, Llt/noframe/gpsfarmguide/dialogs/ModeSelectDialog;->access$000()Landroidx/appcompat/app/AlertDialog;

    move-result-object p1

    invoke-virtual {p1}, Landroid/app/Dialog;->cancel()V

    return-void
.end method
